﻿using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Model;
using YouHP.DALFactory;
using YouHP.Utility;

namespace YouHP.BLL
{
    public class UserActivityBLL
    {
        #region Singleton
        static UserActivityBLL _Instance;
        public static UserActivityBLL Instance
        {
            get
            {
                if (_Instance == null)
                {
                    _Instance = new UserActivityBLL();
                }
                return _Instance;
            }
        }
        #endregion

        #region basic operations
        public bool AddUserActivity(UserActivityInfo info)
        {
            return DataAccess.UserActivityDAL.AddUserActivity(info);
        }

        public bool CheckUserActivity(UserActivityInfo info)
        {
            return DataAccess.UserActivityDAL.CheckUserActivity(info);
        }

        public bool UpdateUserActivity(UserActivityInfo info)
        {
            return DataAccess.UserActivityDAL.UpdateUserActivity(info);
        }

        public bool DeleteUserActivity(int[] ids)
        {
            return DataAccess.UserActivityDAL.DeleteUserActivity(ids);
        }

        public UserActivityInfo GetUserActivityInfo(int id)
        {
            return DataAccess.UserActivityDAL.GetUserActivityInfo(id);
        }
        #endregion

        #region list and search operations
        public List<UserActivityInfo> GetUserActivityList(int pageSize, int pageIndex, out int count)
        {
            return DataAccess.UserActivityDAL.GetUserActivityList(pageSize, pageIndex, out count);
        }

        /*search for management*/
        public List<UserActivityInfo> GetAllUserActivityByUserName(string keyword)
        {
            int count = 0;
            return DataAccess.UserActivityDAL.GetUserActivityByUserName(Constants.maxPageSize, 1, keyword, out count);
        }

        public List<UserActivityInfo> GetAllUserActivityByActivityId(int activityId, string keyword)
        {
            int count = 0;
            return DataAccess.UserActivityDAL.GetUserActivityByActivityId(Constants.maxPageSize, 1, activityId, keyword, out count);
        }
        #endregion
    }
}